import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
import * as dicts from '@/directives/index.js'
// 全局组件
import myComponent from '@/components/index.js'
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)
Vue.use(myComponent)

Vue.config.productionTip = false
// 批量注册指令
Object.keys(dicts).forEach((key) => {
  Vue.directive(key, dicts[key])
})
// 注册处理图片加载失败的指令
// Vue.directive('imgerr', dicts.imgerr)
// 自定义指令基本用法练习
// Vue.directive('fb', {
//   inserted (el, opt) {
//     el.style.border = `3px  solid ${opt.value}`
//   }
// })
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
